﻿
@{
    ViewBag.Title = "结算详情";
    Layout = "~/Views/Shared/DetailsInfoLayout.cshtml";
}

@section CSS{
    <style>
        .content .row { font-family: '微软雅黑','Microsoft YaHei'; }
        .content .form-group span { color: #666; display: block; float: left; width: 80px; }
        .content .form-group label{float:left;width:200px;font-weight:600;}
        .content .form-group{clear:both; line-height:30px;}
        .table td .td_img { width: 80px; height: 80px; float: left; display: block; }
        .table td .td_title { text-align:left;width: 228px; height: 100px; float: left; margin-left: 5px; }
        .table td .td_title b { display: block; color: red; margin-top: 5px; }
        .table td .td_title span { color:#666; margin-top: 5px; }
        .table td  span{color:#666;}
        .table th{background-color:#f4f4f4;text-align:center;}
        #table1 td{text-align:center;}
        #table1 td span { display: block;}
    </style>

}
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <b style="font-size:18px;" >订单信息</b>
            <div class="form-group"  style="margin-top:15px;">
                <span >交易状态：</span>
                <label style="color:red;" id="order_status"></label>
                <span>发货时间：</span>
                <label id="shipment_time"></label>
            </div>
            <div>
                <table id="table1" style="margin-bottom:0px;" class="table table-bg table-bordered">
                    <thead>
                        <tr>
                            <th>商品编号</th>
                            <th>商品信息</th>
                            <th>单价/数量</th>
                            <th>运费</th>
                            <th>实付</th>
                            <th>配送区域</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td id="goods_id"></td>
                            <td>
                                <img class="td_img" id="picture_url" />
                                <div class="td_title">
                                    <a id="goods_name"></a>
                                    <span id="json_specs"></span>
                                </div>
                            </td>
                            <td>
                                <span id="goods_price">￥0.00</span>
                                <br />x <label id="goods_quantity"></label>
                            </td>
                            <td>￥0.00</td>
                            <td id="amount">￥0.00</td>
                            <td>
                                <span id="area"></span>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <table class="table table-bg table-bordered">
                    <tr>
                        <td>
                            <span>订单编号：</span>
                            <label id="order_no"></label>
                        </td>
                        <td>
                            <span>下单时间：</span>
                            <label id="add_time"></label>
                        </td>
                    </tr>
                </table>
            </div>
            
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <b style="font-size:18px;">结算信息</b>
            @if (Model != null)
            {
                <div class="form-group" style="margin-top:15px;">
                    <span>当前状态：</span>
                    <label>@(Model.status == 1 ? "待结算" : (Model.status == 2 ? "正在结算" : (Model.status == 4 ? "待退款" : (Model.status == 5 ? "退款成功" : (Model.status == 6 ? "结算成功" : "异常")))))</label>
                    <span>结算账期：</span>
                    <label>T+@Model.account_period</label>
                </div>
                <div class="form-group">
                    <span>订单金额：</span>
                    <label>￥@Model.order_total.ToString("F2")</label>
                    <span>结算时间：</span>
                    <label>@(Model.settlement_time == null ? "" : Model.settlement_time.ToString("yyyy-MM-dd HH:mm:ss"))  </label>
                </div>
                <div class="form-group">
                    <span>运费：</span>
                    <label>￥0.00 </label>
                    <span>费率：</span>
                    <label>@(Model.service_rate>0?(Model.service_rate + "%") :"-") </label>
                </div>
                <div class="form-group">
                    <span>结算金额：</span>
                    @*<label>￥@(((1-Model.service_rate / 100) * Model.order_total).ToString("F2"))</label>*@
                    <label>￥@(Model.money.ToString("F2"))</label>
                    <span>服务费：</span>
                    @*<label>￥@(((Model.service_rate / 100) * Model.order_total).ToString("F2")) </label>*@
                    <label>@("￥ " + (Model.order_total - Model.money).ToString("F2"))</label>
                </div>
            }

        </div>
    </div>


</section>
@section JS{

    <script type="text/javascript">
        var order_id=@(Model==null?0:Model.order_id);
        $(function () {
            if (order_id != undefined && order_id!="0"){
                GetOrder(order_id);
            }
        })
         function GetOrder(_id) {
            ajax("/finance/GoodsOrder/" + _id, {}, function (data) {
                if (data!= null) {
                    $("#order_status").text(data.order_status);
                    $("#order_no").text(data.order_no);
                    $("#add_time").text(moment(data.add_time).format("YYYY-MM-DD HH:mm:ss"));
                    $("#shipment_time").text(data.shipment_time!=null&&data.shipment_time!=""?moment(data.shipment_time).format("YYYY-MM-DD HH:mm:ss") :"");
                    $("#area").html(data.address.area.replace(/,/g, "<br />"));
                    if(data.goods!=null){
                        $("#goods_id").text(data.goods.goods_id);
                        $("#goods_name").text(data.goods.goods_name);
                        $("#picture_url").attr("src",domain+data.goods.picture_url);
                        $("#json_specs").text(data.goods.json_specs);
                        $("#goods_quantity").text(data.goods.goods_quantity);
                        $("#goods_price").text("￥"+ data.goods.goods_price);
                    }
                    $("#amount").text("￥"+data.amount);
                   
                }
            }, true, "", "get");
        }
    </script>
}

